﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/struts-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean" prefix="bean"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%request.setAttribute("ctx",request.getContextPath()); %>
<html>
<head>
<link href="${ctx}/extend/css/style.css" rel="stylesheet"
	type="text/css" />
<script src="${ctx}/extend/js/jquery/jquery.js" type="text/javascript"></script>
<script src="${ctx}/extend/js/dutil/DUtil.js" type="text/javascript"></script>
<script src="${ctx}/extend/css/css.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="${ctx}/css/style.css" rel="stylesheet" type="text/css" />
<script src="${ctx}/js/common.js" type="text/javascript"></script>
<script src="${ctx}/js/check.js" type="text/javascript"></script>
<script src="${ctx}/js/utils.js" type="text/javascript"></script>
<script src="${ctx}/js/common/merdiseSort.js" type="text/javascript"></script>
<title>添加新资产</title>

</head>


<body class="maintable" >
	<form name="merchandiseForm" method="POST" id="reMdForm"
		action="saveRecord" enctype="multipart/form-data">
		<div id="div_all_document"
			style="height: 100%; overflow-y: auto; position: relative; word-wrap: break-word; word-break: break-all;">
			<div class="dclass_container">
				<div class="dclass_container_header">
					<div class="dclass_container_title">添加新资产</div>
				</div>

				<div class="dclass_container_content">

					<table width="100%" border="0" cellpadding="0" cellspacing="1"
						bgcolor="#9FD6FF">
						<tr>
							<td width="30%" class="formtitle">资产号:<span class="fontred">*</span><span>&nbsp;&nbsp;(自动产生)</span></td>
							<td width="20%" class="formtd"><input name="reMd.assetsNum"
								id="assetsNum" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">自编号:</td>
							<td width="30%" class="formtd"><input name="reMd.selfNum"
								id="selfNum" type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">公司名称:</td>
							<td width="30%" class="formtd"><input name="reMd.compName"
								id="compName" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">业务类型:</td>
							<td width="30%" class="formtd"><input name="reMd.busType"
								id="busType" type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">项目/工程号:</td>
							<td width="30%" class="formtd"><input name="reMd.projNum"
								id="projNum" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">项目/工程名称:</td>
							<td width="30%" class="formtd"><input name="reMd.projName"
								id="projName" type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">资产类型:</td>
							<td class="formtd"><select name="reMd.prodType">
									<c:forEach var="cvar" items="${prodType}">
										<option value="${cvar.key}">${cvar.value}</option>
									</c:forEach>
							</select></td>
							<td width="20%" class="formtitle">资产分类:</td>
							<td class="formtd"><select name="reMdreMdrodClass">
									<c:forEach var="cvar" items="${prodClass}">
										<option value="${cvar.key}">${cvar.value}</option>
									</c:forEach>
							</select></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">设备分类:</td>
							<td class="formtd"><select name="reMd.equipClass">
									<c:forEach var="cvar" items="${equipClass}">
										<option value="${cvar.key}">${cvar.value}</option>
									</c:forEach>
							</select></td>
							<td width="20%" class="formtitle">设备类型:</td>
							<td width="30%" class="formtd"><input name="reMd.equipType"
								id="equipType" type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">设备名称:</td>
							<td width="30%" class="formtd"><input name="reMd.equipName"
								id="equipName" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">设备别名:</td>
							<td width="30%" class="formtd"><input
								name="reMd.equipNickName" id="equipNickName" type="text"
								class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">光缆类型:</td>
							<td class="formtd"><select name="reMd.fiberType">
									<c:forEach var="cvar" items="${fiberType}">
										<option value="${cvar.key}">${cvar.value}</option>
									</c:forEach>
							</select></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">光缆芯数:</td>
							<td width="30%" class="formtd"><input name="reMd.fiberNum"
								id="fiberNum" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">光缆长度:</td>
							<td width="30%" class="formtd"><input
								name="reMd.fiberLength" id="fiberLength" type="text"
								class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">厂家名:</td>
							<td width="30%" class="formtd"><input
								name="reMd.factoryName" id="factoryName" type="text"
								class="inputform" value=""></td>
							<td width="20%" class="formtitle">供货商:</td>
							<td width="30%" class="formtd"><input name="reMd.provider"
								id="provider" type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">设备型号:</td>
							<td width="30%" class="formtd"><input name="reMd.equipModel"
								id="equipModel" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">S/N:</td>
							<td width="30%" class="formtd"><input name="reMd.sn" id="sn"
								type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">模块号:</td>
							<td width="30%" class="formtd"><input name="reMd.modelNum"
								id="modelNum" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">规格:</td>
							<td width="30%" class="formtd"><input name="reMd.standard"
								id="standard" type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">单价:</td>
							<td width="30%" class="formtd"><input name="reMd.unitPrice"
								id="unitPrice" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">入库日期:<span>&nbsp;&nbsp;(系统当前日期)</span></td>
							<td width="30%" class="formtd"><input name="reMd.inputDate"
								id="inputDate" type="text" class="inputform" value="" readOnly></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">出库日期:</td>
							<td width="30%" class="formtd"><input name="reMd.manDate"
								id="manDate" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">仓库管理人:</td>
							<td width="30%" class="formtd"><input
								name="reMd.wareHouseMan" id="wareHouseMan" type="text"
								class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">使用日期:</td>
							<td width="30%" class="formtd"><input name="reMd.useDate"
								id="useDate" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">负责人:</td>
							<td width="30%" class="formtd"><input name="reMd.chargeMan"
								id="chargeMan" type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">资产管理人:</td>
							<td width="30%" class="formtd"><input name="reMd.assetsMgnt"
								id="assetsMgnt" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">设备所在省:</td>
							<td width="30%" class="formtd"><input
								name="reMd.equipLocalProvice" id="equipLocalProvice" type="text"
								class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">设备所在市:</td>
							<td width="30%" class="formtd"><input
								name="reMd.equipLocalCity" id="equipLocalCity" type="text"
								class="inputform" value=""></td>
							<td width="20%" class="formtitle">设备所在区:</td>
							<td width="30%" class="formtd"><input
								name="reMd.equipLocalDistrict" id="equipLocalDistrict"
								type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">设备所在村镇:</td>
							<td width="30%" class="formtd"><input
								name="reMd.equipLocalTown" id="equipLocalTown" type="text"
								class="inputform" value=""></td>
							<td width="20%" class="formtitle">光缆起点:</td>
							<td width="30%" class="formtd"><input name="reMd.fiberStart"
								id="fiberStart" type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">光缆终点:</td>
							<td width="30%" class="formtd"><input name="reMd.fiberEnd"
								id="fiberEnd" type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">光缆起始码号:</td>
							<td width="30%" class="formtd"><input
								name="reMd.fiberStartCode" id="fiberStartCode" type="text"
								class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">光缆终止码号:</td>
							<td width="30%" class="formtd"><input
								name="reMd.fiberEndCode" id="fiberEndCode" type="text"
								class="inputform" value=""></td>
							<td width="20%" class="formtitle">具体位置:</td>
							<td width="30%" class="formtd"><input
								name="reMd.exactLocation" id="exactLocation" type="text"
								class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">所属机架:</td>
							<td width="30%" class="formtd"><input
								name="reMd.belongFrame" id="belongFrame" type="text"
								class="inputform" value=""></td>
							<td width="20%" class="formtitle">所在机框:</td>
							<td width="30%" class="formtd"><input name="reMd.localFrame"
								id="localFrame" type="text" class="inputform" value=""></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">所在槽道:</td>
							<td width="30%" class="formtd"><input
								name="reMd.localChannel" id="localChannel" type="text"
								class="inputform" value=""></td>
							<td width="20%" class="formtitle">当前状态:<span class="fontred">*</span></td>
							<td class="formtd"><select name="reMd.currStatus">
									<c:forEach var="cvar" items="${currStatus}">
										<option id="currStatus" value="${cvar.key}">${cvar.value}</option>
									</c:forEach>
							</select></td>
						</tr>
						<tr>
							<td width="20%" class="formtitle">IP 地址:</td>
							<td width="30%" class="formtd"><input name="reMd.ip" id="ip"
								type="text" class="inputform" value=""></td>
							<td width="20%" class="formtitle">设备功能:</td>
							<td width="30%" class="formtd"><input
								name="reMd.equipFunction" id="equipFunction" type="text"
								class="inputform" value=""></td>
						</tr>
						<%-- 
          <tr>           
            <td width="20%" class="formtitle">修改日期:</td>
            <td width="30%" class="formtd"> <input name="reMd.modifyDate" id="modifyDate" type="text" class="inputform" value="" ></td>
			<td width="20%" class="formtitle">修改原因:</td>
            <td width="30%" class="formtd"><input name="reMd.modifyResult" id="modifyResult" type="text" class="inputform" value=""></td>
          </tr>
           --%>
						<tr>
							<td width="20%" class="formtitle">备注:</td>
							<td colspan="3" width="30%" class="formtd"><textarea
									class="inputformtext100" name="reMd.remarks" id="remarks"></textarea>
							</td>
						</tr>
					</table>
					<br style="line-height: 5px;" /> <br style="line-height: 5px;" />
					<div style="padding: 0.3em; text-align: center">
						<input type="button" class="btn1" value="保 存"
							onclick="javascript:saveReMd();" /> 
						<!-- Removed by Doug@0822 -->
						<!-- <input type="button"
							class="btn1" value="关 闭" onclick="javascript:window.close();" /> -->
					</div>
				</div>
			</div>
		</div>
	</form>
	<script type="text/javascript">
	window.onload=defaultLoadFunction();
	
	function defaultLoadFunction(){
		<%--genAssetsNum();
		setInputDate();--%>
	}
	
    function saveReMd(){
   		if(checkMd()){
			var reMdForm=document.getElementById("reMdForm");
	       	reMdForm.action="${ctx}/admin/saveRecord";
	        reMdForm.submit();
       }
    }
	function checkMd(){
		var currStatus = document.getElementById("currStatus");
		var fiberNum = document.getElementById("fiberNum");
		var fiberLength = document.getElementById("fiberLength");
		var unitPrice = document.getElementById("unitPrice");
		var ip = document.getElementById("ip");
		var manDate = document.getElementById("manDate");
		var useDate = document.getElementById("useDate");
		
		if(checkNull(currStatus)){
			alert("当前状态必须选择!");
			document.getElementById("currStatus").focus();
			return false;
		}
		
		if(!checkNull(fiberNum)) {
			if(! checkPositiveNum(fiberNum)){
				alert("光缆芯数必须是数字并且大于0!");
				document.getElementById("fiberNum").focus();
				return false;
			}
			
		}
		
		if(!checkNull(fiberLength)) {
			if(! checkPositiveNum(fiberLength)){
			alert("光缆长度必须是数字并且大于0!");
			document.getElementById("fiberLength").focus();
			return false;
			}
		
		}
		
		if(!checkNull(unitPrice)) {
			if(! checkMoney8(unitPrice)){
			alert("单价必须是数字并且大于0!");
			document.getElementById("unitPrice").focus();
			return false;
			}
		}
		
		if(!checkNull(ip)) {
			if(!checkIp(ip)) {
				alert("IP格式不正确!");
				document.getElementById("ip").focus();
				return false;
			}
		}
		
		if(!checkNull(manDate)) {
			if(!checkDate(manDate)) {
				alert("日期不正确!");
				document.getElementById("manDate").focus();
				return false;
			}
		}
		
		if(!checkNull(useDate)) {
			if(!checkDate(useDate)) {
				alert("日期不正确!");
				document.getElementById("useDate").focus();
				return false;
			}
		}
		
		return true;
	}
	
	function setInputDate() {
		var inputDate = document.getElementById("inputDate");
		var currDate = getCurrDate();
		var formatVal = formatDate(currDate);
		inputDate.value = formatVal;
	}
	
	
	function genAssetsNum(){
		var assetsNum = document.getElementById("assetsNum");
		var currMillSecond = getCurrMillSeconds();
		assetsNum.value = currMillSecond;	
	}
	
	
	
	
</script>
</body>
</html>